class RegisterController < ApplicationController
 layout "common_layout"
  
  def register
    @user_type_select = params[:user_type_select]
    if @user_type_select =="student"
      redirect_to(:controller =>"register", :action => "student_register")
    end
    if @user_type_select =="teacher"
      redirect_to(:controller =>"register", :action => "teacher_register")
    end
  end
  
  def student_register
    @student = User.new(params[:student])
    @student.user_type = "student"
    if request.post? and @student.save
      flash[:notice] = "Congratulations, successfully registered!"
#      @student = Student.new
      redirect_to(:controller =>"login", :action => "login")
    end
  end
  
  def teacher_register
    @user = User.new(params[:teacher])
    @user.user_type = "teacher"    
    if request.post? and @user.save
      flash[:notice] = "Congratulations, successfully registered!"
#      @student = Student.new
      redirect_to(:controller =>"login", :action => "login")
    end
  end
end
